<script src="../js/vue.js"></script>

<div id="app">
  <h1>今天天气很{{ weather }}</h1>
  <button @click="toggleWeather">切换天气</button>
</div>

<script>
  new Vue({
    el: '#app',
    data: {
      weather: '炎热'
    },
    methods: {
      toggleWeather() {
        this.weather = this.weather === '炎热' ? '凉爽' : '炎热';
      }
    }
  });
</script>